﻿Public Module ModDebugLog
    Public Property DebugLog As LogSub
    Public Class DebugTrace
        Inherits TraceListener
        Public Property OutPut As Boolean = False
        Public Shared ReadOnly Property Instance As New DebugTrace
        Private ReadOnly Time As Long
        Private Sub New()
            Time = Sy.Environment.TickCount
        End Sub
        Private ReadOnly Property NeedOutPut As Boolean
            Get
                Return OutPut AndAlso Sy.Environment.TickCount - Time > 10000
            End Get
        End Property
        Public Overrides Sub Write(message As String)
            If NeedOutPut Then DebugLog?(message)
        End Sub

        Public Overrides Sub WriteLine(message As String)
            If NeedOutPut Then DebugLog?(message)
        End Sub
    End Class
End Module
